# Contributor: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>

_pkgname=pybox2d
pkgname=python-pybox2d
pkgver=2.3.10
pkgrel=2
epoch=1
pkgdesc='Python wrapper for Box2D'
arch=('loong64' 'x86_64')
url='https://github.com/pybox2d/pybox2d'
license=('custom')
depends=('python')
makedepends=('python-setuptools' 'swig')
source=("$pkgname-$pkgver.tar.gz::https://github.com/pybox2d/$_pkgname/archive/$pkgver.tar.gz")
sha256sums=('5471722f290b7285dcbdee9bef61d1cb424e5a610fa6e19e9ddeb854c7e3b937')

build() {
	cd $_pkgname-$pkgver
	swig -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library/Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D/Box2D_wrap.cpp Box2D/Box2D.i
	python setup.py build
}

check() {
	cd $_pkgname-$pkgver
	PYTHONPATH="$PWD"/library/Box2D python setup.py test
}

package() {
	cd $_pkgname-$pkgver
	python setup.py install --root "$pkgdir" --optimize=1 --skip-build
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
